/**
 * 
 */
package com.activityes.primeirapagina;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;

import com.main.primeirapagina.R;

/**
 * 
 * @author Hydrus Technology.
 * 
 */
public class ResumoPedidoActivity extends Activity {

	private List<Map<String, Object>> viagens;

	private ListView listView;
	private AdapterListView adapterListView;
	private ArrayList<ItemListView> itens;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.resumo_pedido);

		listView = (ListView) findViewById(R.id.list);

		createListView();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.activity_dashboard, menu);
		return true;
	}

	@Override
	public boolean onMenuItemSelected(int featureId, MenuItem item) {
		switch (item.getItemId()) {
		case R.id.menu_cardapio:
			startActivity(new Intent(this, ResumoPedidoActivity.class));
			return true;
		case R.id.menu_pedidos:
			return false;
		case R.id.menu_historico:
			return false;
		case R.id.menu_top:
			return false;
		default:
			return super.onMenuItemSelected(featureId, item);
		}
	}

	/*
	 * @Override public void onItemClick(AdapterView<?> parent, View view, int
	 * position, long id) { Map<String, Object> map = viagens.get(position);
	 * String destino = (String) map.get("categoria"); String mensagem =
	 * "Opção selecionada: " + destino; Toast.makeText(this, mensagem,
	 * Toast.LENGTH_SHORT).show(); if (destino.equalsIgnoreCase("Comidas")) {
	 * startActivity(new Intent(this, ComidasActivity.class)); } }
	 */

	private List<Map<String, Object>> listarViagens() {
		viagens = new ArrayList<Map<String, Object>>();
		Map<String, Object> item = new HashMap<String, Object>();
		item.put("icone", R.drawable.comidas);
		item.put("categoria", "Comidas");
		// item.put( "categoria", R.style.TitleFont );
		item.put("descricao", "(Cebola, Carne)");
		viagens.add(item);
		/*
		 * item = new HashMap<String, Object>(); item.put("icone",
		 * R.drawable.bebidas); item.put("categoria", "Bebidas");
		 * item.put("descricao", "(Whisky,Cerveja)"); viagens.add(item); item =
		 * new HashMap<String, Object>(); item.put("icone",
		 * R.drawable.sobremesas); item.put("categoria", "Sobremesas");
		 * item.put("descricao", "(Doces, Tortas)"); viagens.add(item); item =
		 * new HashMap<String, Object>(); item.put("icone",
		 * R.drawable.sobremesas); item.put("categoria", "Entradas");
		 * item.put("descricao", "(Queijo, Pães)"); viagens.add(item);
		 */
		return viagens;
	}

	private void createListView() {
		// Criamos nossa lista que preenchera o ListView
		itens = new ArrayList<ItemListView>();

		ItemListView item1 = new ItemListView(
				R.drawable.camarao_ao_chopp_150px,
				getString(R.string.camarao_ao_chopp),
				getString(R.string.camarao_ao_chopp_descricao));
		/*
		 * ItemListView item2 = new ItemListView("Lucas Volgarini",
		 * R.drawable.volgarini); ItemListView item3 = new
		 * ItemListView("Eduardo Ricoldi", R.drawable.ricoldi); ItemListView
		 * item4 = new ItemListView("Felipe Panngo", R.drawable.panngo);
		 */

		itens.add(item1);
		/*
		 * itens.add(item2); itens.add(item3); itens.add(item4);
		 */

		// Cria o adapter
		adapterListView = new AdapterListView(this, itens);

		// Define o Adapter
		listView.setAdapter(adapterListView);

		// Cor quando a lista é selecionada para ralagem.
		listView.setCacheColorHint(Color.TRANSPARENT);
	}
}
